var limsExperimentalTemplate = Gikam.getPageObject({

    getEditListColumns : function() {
        return [ {
            checkbox : true
        }, {
            index : true
        }, {
            field : 'etCode',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE.ETCODE',
            validators: ['notEmpty'],
        }, {
            field : 'etName',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE.ETNAME',
            width: 140,
            validators: ['notEmpty'],
            editor: true
        }, {
            field : 'etType',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE.ETTYPE',
            validators: ['notEmpty'],
            editor: true,
            type: 'select',
            search: true,
            category: 'sys',
            param: {
                codeCategoryId: 'experimentalTemplateCategory'
            },
        } ];
    },

    getBaseInfoFormFields : function() {
        return [ {
            field : 'etCode',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE.ETCODE',
            preInsert: true,
            validators: ['unique[/secure/basemodule/coredata/experimental-templates/action/validate-unique]'],
        }, {
            field : 'etName',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE.ETNAME',
            preInsert: true,
            validators : [ 'strLength[0,22]' ]
        }, {
            field : 'etType',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE.ETTYPE',
            preInsert: true,
            validators : [ 'strLength[0,11]' ],
            type: 'select',
            search: true,
            category: 'sys',
            param: {
                codeCategoryId: 'experimentalTemplateCategory'
            },
        }, ];
    },

    getChooseListColumns : function() {
        return [ {index: true},{
            field : 'etCode',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE.ETCODE',
            width: 160,
        }, {
            field : 'etName',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE.ETNAME',
        }, {
            field : 'etType',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE.ETTYPE',
            type: 'select',
            search: true,
            category: 'sys',
            param: {
                codeCategoryId: 'experimentalTemplateCategory'
            },
            width: 160,
        }, ];
    },

    getEtTestListColumns : function() {
        return [ {
            checkbox : true
        }, {index: true},{
            field : 'orderNo',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST.ORDERNO',
            validators: ['notEmpty', 'integer', 'numRange(0,)'],
            editor: true,
        }, {
            field : 'id',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST.ID',
            width : 140
        }, {
            field : 'testCode',
            title : 'T_LIMS_TEST.TESTCODE'
        }, {
            field : 'testName',
            title : 'T_LIMS_TEST.TESTNAME'
        }, {
        //     field : 'skipAssignment',
        //     title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST.SKIPASSIGNMENT'
        // }, {
        //     field : 'skipReview',
        //     title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST.SKIPREVIEW'
        // }, {
            field : 'lastTestIds',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST.LASTTESTIDS',
            width : 140,
            editor: true,
            type: 'choose',
            category: 'lastTestChoose',
            onBeforeChoose: function (index) {
                return {
                    etId_SEQ: this.getActivedRow().etId,
                    orderNo_SEQ: this.getActivedRow().orderNo - 1,
                }
            },
            onClean: function (field, value, rowIndex) {
                this.setData({
                    index: rowIndex,
                    lastTestIds: "",
                    lastTestCodes: "",
                    lastTestNames: "",
                })
            },
            onAfterChoose: function (rows, index) {
                if (Gikam.isNotEmpty(rows)) {
                    this.setData({
                        index: index,
                        lastTestIds: rows.map(e => e.id).join(","),
                        lastTestCodes: rows.map(e => e.testCode).join(","),
                        lastTestNames: rows.map(e => e.testName).join(","),
                    })
                }
            }
        }, {
        //     field : 'lastTestCodes',
        //     title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST.LASTTESTCODES'
        // }, {
            field : 'lastTestNames',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST.LASTTESTNAMES'
        } ];
    },

    getEtTestListColumns1 : function() {
        return [ {
            checkbox : true
        }, {index: true},{
            field : 'orderNo',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST.ORDERNO',
        }, {
            field : 'id',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST.ID',
            width : 140
        }, {
            field : 'testCode',
            title : 'T_LIMS_TEST.TESTCODE'
        }, {
            field : 'testName',
            title : 'T_LIMS_TEST.TESTNAME'
        }, {
            field : 'lastTestIds',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST.LASTTESTIDS',
            width : 140,
            type: 'choose',
            category: 'lastTestChoose',
            onBeforeChoose: function (index) {
                return {
                    etId_SEQ: this.getActivedRow().etId,
                    orderNo_SEQ: this.getActivedRow().orderNo - 1,
                }
            },
        }, {
            field : 'lastTestNames',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST.LASTTESTNAMES'
        } ];
    },

    getTestChooseListColumns : function() {
        return [{index: true}, {
            field : 'testCode',
            title : 'T_LIMS_TEST.TESTCODE'
        }, {
            field : 'testName',
            title : 'T_LIMS_TEST.TESTNAME'
        }];
    },

    getEtMethodListColumns : function() {
        return [ {
            checkbox : true
        }, {index: true},{
            field : 'methodCode',
            title : 'T_LIMS_METHOD.METHODCODE',
            width: 120,
        }, {
            field : 'methodDesc',
            title : 'T_LIMS_METHOD.METHODDESC',
            width: 140
        }, {
            field : 'defaultMethod',
            title : 'T_LIMS_EXPERIMENTAL_TEMPLATE_TEST_METHOD.DEFAULTMETHOD',
            type : 'simpleCheckbox',
            width : 160,
            editor : true
        } ];
    },

    baseUrl : IFM_CONTEXT + '/secure/basemodule/coredata/experimental-templates',
    etTestUrl : IFM_CONTEXT + '/secure/basemodule/coredata/experimental-template-tests',
    etTestMethodUrl : IFM_CONTEXT + '/secure/basemodule/coredata/experimental-template-test-methods'
});
